<?php
error_reporting(E_ALL ^ E_DEPRECATED);

$host = "localhost";
$user = "root";
$pass = "";
$db = "music-users";

mysql_connect($host, $user, $pass);
mysql_select_db($db);

if (isset($_POST['username'])){

$username = $_POST['username'];
$password = $_POST['password'];
$sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."'";
$res = mysql_query($sql);

if(mysql_num_rows($res) == 1){
	echo "You have successfully logged in.";
	exit();
	}
	else {
		echo "<script>alert('Invalid input');</script>";
		}	
}
?>

<!DOCTYPE html>
<html>
<head>
<style>
body
{
background-image:url("pattern.jpg");
background-repeat:no-repeat;
background-attachment:fixed;
}

h4 {color:#DEDEDE;
    font-family: Helvetica, Geneva, Arial,
          SunSans-Regular, sans-serif }
		  h4 {color:#DEDEDE;
    font-family: Helvetica, Geneva, Arial,
          SunSans-Regular, sans-serif }
</style>
</head>

<header>
   <div align="left"><a href="/login.php"><img src="logo1.png" alt="logo" /></a></div>
</header>

<body>

<form method="post" action="#">
<h4>
Username: <input type="text" name="username" /><br /><br />
Password: <input type="password" name="password" /><br />
</h4>

<input type="submit" name="submit" value="Log in" /> <br /><br />

<h4>or</h4>
<div align="left">
<h4>
  <a href="register.php" Register> Register </a>
  </h4>
</div>

</body>

</html>
